<div>
<div id="select1-html">
	<style>
		table .td5{ width: 15%;}
	</style>
    <section class="select-menu">

		<div class="titles fiex" style="position: relative;">
			<div class="black"><a href="#!root-html" ><svg class="g2" ><use xlink:href="#f_black"></use></svg></a></div>
			<div class="fiex1 f-30 ellipsis "><span data-l="1050"></span> <span  class="title1"></span></div>
			<div class="fiex1 set-jianpan">
         		<input class="search-top" id="search-top" type="search" oncomplete data-p="1128"  />
            </div>
		</div>
		
        <div class="menu-btm">
            <div class="menu-btm-box">
            	<div class="caipu_top_box">
            		<div class="caipu_top f-28" id="caipu_top"></div>    
            	</div>
            	<script id="menu-top" type="text/html">
            		{{each list as v i}}
            			<a href="javascript:;" id="caipu_{{v.id}}" {{if v.id==cur}}class="on"{{/if}} data-cookbook={{v.id}} >{{v.cookbook_name}}<i></i></a> 
            			
            		{{/each}}
            	</script>
                <div class="menu-left" id="menu-left" style="top: 0.8rem;"></div>
                <script id="menu-left-js" type="text/html">
                    <ul>
                        {{each list as v i}}
                        	{{if v.hide!=1 && v.lefttime!=0}}
	                        <li id="menuleft-{{v.id}}" data-id="{{v.id}}"><i></i>
	                        	<span>
	                        	{{if v.id==1 || v.id==2}}<svg class="g1"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#f_6"></use></svg>{{/if}}
	                        	{{v.goods_cate_name}}
	                        	
	                        	</span></li>
	                       {{/if}}
                        {{/each}}
                    </ul>
                    
                    <div class="bank100"></div>
                </script>

                <div class="menu-right" id="menu-right"></div>

                <script type="text/html" id="menu-right-js">
                	<div>
                    {{each list as v i}}
                    <div class="box" style="display: none;"  id="main-right-box-{{v.id}}"  data-id="{{v.id}}">
                        <div class="tit">{{v.goods_cate_name}}</div>
                        <div class="group">                            
                            {{each v.goods_list as vv ii}}
                                {{if vv.status==1 && vv.hide!=1 && vv.lefttime==1}}
                                <div class="item {{if menu==0}}disable{{/if}}  item-{{vv.id}}" data-parent-id="{{vv.goods_cate_id}}" data-id="{{vv.id}}" data-num="0" data-price="{{vv.goods_price}}" data-goodsspecid="{{vv.goods_spec_id}}">
                                    <div class="w cf">
                                    	{{if vv.goods_thumb!=""}}
        <!--                            	<div class="fl"><img class="lazy" originalsrc="{{vv.goods_thumb}}" /></div>-->
                                        <div class="fl"><img style="background: url({{oss}}/Public/Upload/image/{{vv.goods_thumb}}?x-oss-process=image/resize,m_fill,h_150,w_150) no-repeat center; background-size: cover;"  src="../images/null.gif" /></div>
                                        {{/if}}
                                        <div class="oh">
                                            <div class="t1 ">{{vv.goods_name}}</div>                                         
                                            <div class="t3 cf">
                                            	
                                                <div class="oh f-30">{{vv.goods_price}}</div>  
                                               
                                            </div>
                                        </div>
                                    </div>                                   
                                    <div class="addright cf spec {{if !vv.garnish_list[0]}}{{if !vv.spec_list[0]}}{{if !vv.taste_list[0]}}{{if vv.is_prompt!=1}}nullspec{{/if}}{{/if}}{{/if}}{{/if}}" data-parent-id="{{vv.goods_cate_id}}" data-id="{{vv.id}}" data-num="0" data-price="{{vv.goods_price}}" {{each vv.spec_list as ss nn}} data-{{ss.goods_spec_id}}="0"{{/each}} >
                                        <div class="p p1 {{if vv.garnish_list[0] || vv.spec_list[0] || vv.taste_list[0]}}null{{/if}}">
                                        	<em class="specem" data-l="1054"></em>
                                        	<i></i><svg class="g1" ><use xlink:href="#f_4"></use></svg></div>
                                        <span class="g3">0</span>
                                        <div class="p p2 addgwc"><i></i><svg class="g2" ><use xlink:href="#f_5"></use></svg></div>
                                    </div>
                                   
                                </div>
                                {{/if}}
                            {{/each}}  
                            
                        </div>
                    </div>
                    {{/each}}
                    <div id="nulldata" class="nulldata f-30 center mag-t-30" data-l="1129" style="display: none;"></div>
                    </div>
                    <div class="bank50" ></div>                    
                    <div class="bank100"></div>
                </script>

            </div>
        </div>

        <div class="select-buy" id="select-buy" >
             <div class="right">
             	<a href="javascript:;" id="xuanhaole" data-l="1004"></a>
            	<a href="javascript:;" id="xiachu" data-l="1026"></a>
             </div>
            <div class="left cf">
                <div class="gw" id="icon_gw"><i></i><em style="display: none;"></em>
                    <svg class="g1" ><use xlink:href="#f_7"></use></svg>
                </div>
                <div class="sum" id="total_price" data-price=""><span></span></div>
            </div> 
            <div class="carbuy">
                <div class="car-tit cf">
                	<a href="javascript:;" class="back">
                		<svg class="g2"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#f_10"></use></svg>
                	</a>
                    <div class="fl pad-l-50"><span data-l="1005"></span></div>
                    <div class="fr"> <svg class="g1" ><use xlink:href="#f_8"></use></svg><span data-l="1006"></span></div>
                </div>
                <div class="car-box ">
                    
 					<div class="order-tab-head s2 mag-l-20 mag-r-20 pad-t-20">
			        	<table>
			        		<tr>
			        			<td class="td1"><div class="w">.No</div></td>
			        			<td class="td2"><div class="w" data-l="1063"></div></td>
			        			<td class="td3"><div class="w" data-l="1064"></div></td>
			        			<td class="td4"><div class="w" data-l="1065"></div></td>
				        		<td class="td5"><div class="w" data-l="1066"></div></td>
			        		</tr>
			        	</table>
			        </div>
                    <div class="my-list" id="my-list"></div>
                    
                      <div class="pad-20" style="padding-top: 0;">
                	  <dl class="dl mag-t-10  guige-box4 beizhu-bon">
						<dt class="mag-b-10 c999 fiex">
							
							<div class="fiex1  fiex">
								<div class="fiex1" data-l="1021"></div> 
								<div  class="fiex3" id="beizhu_p"></div>
							</div>
							<div class="fr f-right ">
								<svg class="g2" ><use xlink:href="#f_5"></use></svg>
							</div>
						</dt>
					</dl>
                    	
               		<div class="line-ddd"></div>
						
						<dl class="dl pad-t-10  guige-box5">
							<dt class="mag-b-10 c999 fiex">
								<div class="fiex1 f-28"><span data-l="1196"></span></div>
								<div class=" f-right">
									<div class="weui-cell" style="padding: 0;">
								        <div class="weui-cell__ft">
								          <input class="weui-switch beizhu-open" id="other_set0_2" style="vertical-align: top;" type="checkbox">
								        </div>
								      </div>
								</div>
							</dt>
						</dl>

                    </div>
                    
                    <div class="other-list" id="other-list" style="display: none;"></div>
                    
                  
                </div>
            </div>  
        </div>
         <div class="select-buy center fiex " id="select-buy1" style="background: #999; display: none;">
         	<p style=" color: #fff;" class="fiex1"></p>
         </div>
		
		<script type="text/html" id="select-buy-js1">
			{{if my_number}}				
                {{each my_list as v i}}
                	{{if i==member_id}}
                	{{if i!=""}}<div class="n user cf" style="display: none;">
                		<div class="fl red"><span data-l="1007"></span> </div>
                		<div class="fr"><span data-l="1061"></span> {{i}}</div>
                	</div>{{/if}}
                	<div class="car-ul order-art-list" style="padding-top: 0;">
                	{{each v as vv ii}}                	
                    {{if vv.status==1}}                    	
                        <div class="item-l" id="item-l-{{vv.cart_id}}" data-goods_id="{{vv.goods_id}}" data-cart_id="{{vv.cart_id}}" {{if setmenumore!="1" && vv.cookbook!=curcookbook}} style="display: none;"{{/if}}>
				                <table>   
				                   <tr class="item f-28">
				            	<td class="td1" {{if vv.remarks}}rowspan="2"{{/if}}><div class="w center">{{ii+1}}</div></td>
				    			<td class="td2">
				    				<div class="w ">
										<span>{{vv.goods_name}} </span>
					                	{{if vv.goods_spec_name}}<span class="c999">[{{vv.goods_spec_name}}]</span>{{/if}}
					                	{{if vv.goods_taste_name}}<span class="c999">[{{vv.goods_taste_name}}]</span>{{/if}} 
									 {{each vv.garnish_ids as vvv iii}}
					                    	<div class="clear"></div>
					                    	<div class="mag-l-15 f-22 c999 {{if iii==0}}mag-t-5{{/if}}">
					                        	{{vvv.goods_garnish_name}}
						                        <span class="red">x{{vvv.count}}</span>	
					                    	</div>
					                    {{/each}}	            			
					    			</div>
				    			</td>
				    			<td class="td3"><div class="w center bon">
				    				<div class="addright cf" data-parent-id="{{vv.goods_cate_id}}"  data-cart_id="{{vv.cart_id}}" data-id="{{vv.goods_id}}" data-num="{{vv.count}}" data-price="{{vv.goods_price}}" data-specid="{{vv.spec_id}}" data-goodsspecid="{{vv.goods_spec_id}}">
				                                <div class="p p1"><i></i><svg class="g1" ><use xlink:href="#f_4"></use></svg></div>
				                                <span class="g3  red">{{vv.count}}</span>
				                                <div class="p p2"><i></i><svg class="g2" ><use xlink:href="#f_5"></use></svg></div>
				                            </div>
				    			</div></td>
				    			<td class="td4"><div class="w center red">{{vv.total_price}}</div></td>
				    			<td class="td5 {{if vv.is_pack==1}}on{{/if}}"><div class="w pak">				    				
				    				<svg class="g1" ><use xlink:href="#f_11"></use></svg>
				    			</div></td>
				            </tr>
				            		{{if vv.remarks}}
				        			<tr>
				        				<td colspan="3"><div class="w aaa">{{vv.remarks}}</div></td>        				
				        			</tr>
				        			{{/if}}
				                         </table>   
				                         <div class="bottoms" data-parent-id="{{vv.goods_cate_id}}"  data-cart_id="{{vv.cart_id}}" data-id="{{vv.goods_id}}" data-num="1" data-name="{{vv.goods_name}}"  data-price="{{vv.goods_price}}" data-specid="{{vv.spec_id}}" data-goodsspecid="{{vv.goods_spec_id}}">
				                         
				                         </div>
				                 </div>
                    {{/if}}
                    {{/each}}
                    </div>
                    {{/if}}
                {{/each}}
            {{else}}
                <div class="nodata lang"  ><span data-l="1009"></span></div>
            {{/if}}
		</script>
		<script type="text/html" id="select-buy-js2">
			{{if th_number}} 
                {{each my_list as v i}}
                	{{if i!=member_id}}
                	{{if i!=""}}<div class="n user cf" style="display: none;">
                		<div class="fl green"><span data-l="1008"></span> </div>
                		<div class="fr"><span data-l="1061"></span> {{i}}</div>
                	</div>{{/if}}
                	<div class="car-ul order-art-list" style="padding-top: 0;">
                	{{each v as vv ii}}                	
	                    {{if vv.status==1}}                    	
	                        <div class="item-l f-24" id="item-l-{{vv.cart_id}}" data-goods_id="{{vv.goods_id}}" data-cart_id="{{vv.cart_id}}">
				                <table>   
				                   <tr class="item">
				            	<td class="td1" {{if vv.remarks}}rowspan="2"{{/if}}><div class="w center">{{ii+1}}</div></td>
				    			<td class="td2">
				    				<div class="w ">
										<span>{{vv.goods_name}} </span>
					                	{{if vv.goods_spec_name}}<span class="c999">[{{vv.goods_spec_name}}]</span>{{/if}}
					                	{{if vv.goods_taste_name}}<span class="c999">[{{vv.goods_taste_name}}]</span>{{/if}} 
									   {{each vv.garnish_ids as vvv iii}}
					                    	<div class="clear"></div>
					                    	<div class="mag-l-15 f-22 c999 {{if iii==0}}mag-t-5{{/if}}">
					                        	{{vvv.goods_garnish_name}}
						                        <span class="red">x{{vvv.count}}</span>	
					                    	</div>
					                    {{/each}}	            			
					    			</div>
				    			</td>
				    			<td class="td3"><div class="w center bon">
				    				<div class="addright cf" data-parent-id="{{vv.goods_cate_id}}"  data-cart_id="{{vv.cart_id}}" data-id="{{vv.goods_id}}" data-num="{{vv.count}}" data-price="{{vv.goods_price}}" data-specid="{{vv.spec_id}}" data-goodsspecid="{{vv.goods_spec_id}}">
				                                <div class="p p1 disable" style="opacity: 0.0;"><i></i><svg class="g1" style="fill: #333;" ><use xlink:href="#f_4"></use></svg></div>
				                                <span class="g3  red">{{vv.count}}</span>
				                                <div class="p p2 disable" style="opacity: 0.0;"><i></i><svg class="g2" ><use xlink:href="#f_5"></use></svg></div>
				                            </div>
				    			</div></td>
				    			<td class="td4"><div class="w center red">{{vv.total_price}}</div></td>
				    			<td class="td5"><div class="w pak">&nbsp;</div></td>
				            </tr>
				            		{{if vv.remarks}}
				        			<tr>
				        				<td colspan="3"><div class="w aaa">{{vv.remarks}}</div></td>        				
				        			</tr>
				        			{{/if}}
				                         </table>   
				                         <div class="bottoms" data-parent-id="{{vv.goods_cate_id}}"  data-cart_id="{{vv.cart_id}}" data-id="{{vv.goods_id}}" data-num="1" data-name="{{vv.goods_name}}"  data-price="{{vv.goods_price}}" data-specid="{{vv.spec_id}}" data-goodsspecid="{{vv.goods_spec_id}}">
				                         
				                         </div>
				                 </div>
	                    {{/if}}
                    {{/each}}
                    </div>
                    {{/if}}
                {{/each}}
            {{else}}
                <div class="nodata lang"  ><span data-l="1010"></span></div>
            {{/if}}
		</script>
		
		<div class="guige"></div>
		<script type="text/html" id="guige-js">
			<div class="guige-box"><i class="bg"></i>
				<div class="g-box">
					<a href="javascript:;" class="close1"><svg class="g2" ><use xlink:href="#f_9"></use></svg></a>
					<div class="w">
						<div class="maxscroll">
						<div class="name center ellipsis f-32">{{name}}</div>
						
						{{if spec[0]}}
						<dl class="dl mag-t-10 guige-box1" id="guige-box1">
							<dt class="mag-b-10 c999"><span data-l="1053"></span></dt>
							<dd class="f-26 pad-t-10 pad-b-20">
								{{each spec as v i}}
								<a href="javascript:;" class="{{if i==0}}on{{/if}}" data-id="{{v.spec_id}}" data-price="{{v.goods_price}}">{{v.goods_spec_name}}<div class="red f-24">{{v.goods_price}}</div></a>
								{{/each}}
							</dd>
						</dl>
						<div class="line-ddd "></div>
						{{/if}}
						
						{{if taste[0]}}
						<dl class="dl mag-t-10  guige-box2" id="guige-box2">
							<dt class="mag-b-10 c999"><span data-l="1055"></span></dt>
							<dd class="f-26 pad-t-10 pad-b-20">
								{{each taste as v i}}
								<a href="javascript:;" class="{{if i==0}}on{{/if}}" data-id="{{v.taste_id}}" data-price="{{v.goods_price}}">{{v.goods_taste_name}}</a>
								{{/each}}
							</dd>
						</dl>
						<div class="line-ddd "></div>
						{{/if}}
						
						{{if garnish[0]}}
						<dl class="dl mag-t-10  guige-box3" id="guige-box3">
							<dt class="mag-b-10 c999"><span data-l="1056"></span></dt>
							<dd class="f-26 pad-t-10 pad-b-20 guige-peicai-list">
								{{each garnish as v i}}
								<a href="javascript:;" class="" data-id="{{v.garnish_id}}" data-price="{{v.goods_price}}" data-name="{{v.goods_garnish_name}}" data-count="0" ><em>1</em>{{v.goods_garnish_name}}<div class="red f-24">{{v.goods_price}}</div></a>
								{{/each}}
																
							</dd>
						</dl>
						
						{{/if}}
						
						<div class="bank100"></div>
						
						</div>
						
						<div class="b cf fiex">
							<div class="fiex2 bs1 red f-32 " id="pirce_b" style="min-width: 5em;">
								{{each spec as v i}}{{if i==0}}{{v.goods_price}}{{/if}}{{/each}}
							</div>
							<div class="fiex3 bs2">
								<div class="addright_s cf" id="addright_s" data-count="1" >
                                    <div class="p p1 disable"><i></i><svg class="g1"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#f_4"></use></svg></div>
                                    <span class="g3 f-30">1</span>
                                    <div class="p p2 "><i></i><svg class="g2"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#f_5"></use></svg></div>
                                </div>
							</div>
							<div class="fiex3 bs3 f-right"><a href="javascript:;" class="bon-red f-32" data-l="1013"></a></div>
							
						</div>
					</div>
				</div>
			</div>
		</script>

		<div class="beizhu" id="beizhu"></div>
	<script type="text/html" id="beizhu-js">
			<div class="guige-box">
				<div class="bg"></div>
				<div class="g-box">
					<a href="javascript:;" class="close1"><svg class="g2"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#f_9"></use></svg></a>
					<div class="w">
						<div class="maxscroll">						
						
						<dl class="dl mag-t-10  guige-box4" id="all-beizhu" >
							
							<dd class="f-24 pad-t-10 pad-b-20" id="guige-beizhu" style="display: block;">
								
				                {{if beizhu}}
				                	{{each beizhu as v i}}
				                		<span class="gp st-a">
				                			{{each v.list as vv ii}}
						                		<a href="javascript:;" class="a" >{{vv.name}}</a>
						                	{{/each}}
										</span>
				                	{{/each}}
				                {{/if}}
				                
				                <br>
				                <div class="f-right fiex input">
				                	<div class="fiex3">
				                		<input type="text" id="beizhuinp" maxlength="100" placeholder="" data-p="1068" />
				                	</div>
				                	<div class="fiex2">
				                		<span class="bon-black bon" style="padding: 0.1rem 0.2rem;" data-l="1067"></span>
				                	</div>				                	
				                </div>
							</dd>
						</dl>
						
						<div class="bank100"></div>
							<div class="b cf fiex">
							
							<div class="fiex1 f-right">
								<div class="pad-r-15"><a href="javascript:;" class="bon-red f-32"  data-l="1016"></a></div>
							</div>
							
						</div>
						</div>
					</div>
					</div>
				
					
				
			</div>
		</script>
		<style>
			.other-list table .td5 .w:before{ border-color: #fafafa;}
			table .td4{border-right: 1px solid #aaa;}
			.other-list { opacity: 0.7;}
		</style>
        <div class="select_article">
            <div class="box">
                <a href="javascript:;" class="close"><svg class="g2" ><use xlink:href="#f_9"></use></svg></a>
                <div class="w" style="padding: 0.2rem;" id="article-w"></div>                
            </div>
            <i class="bg_mask"></i>
        </div>

        <div class="mask"></div>      
    </section>
    <script type="text/html" id="article-js">
                	<div class="cf mag-b-10">
                		 {{if goods_thumb!=""}}
                		 <div class="img  mag-b-20" style=" width:100%; background-image: url({{oss}}/Public/Upload/image/{{goods_thumb}}?x-oss-process=image/resize,m_fill,h_600,w_600);">
                		 	<img src="{{oss}}/Public/Upload/image/{{goods_thumb}}?x-oss-process=image/resize,m_fill,h_600,w_600" style="height: 6.2rem;" onerror="lod(this)" />
                		 </div>
                		 {{/if}}
                		 <div class="oh">
                		 	<div class="t1">{{goods_name}}</div>
                    		<div class="t2" style="padding: 0.1rem  0 0;">{{goods_price}}</div>
                		 </div>
                	</div>
                   
                    <div class="line-eee"></div>
                    <div class="tmaxheigt" >
                    	<div class="t3">
                        <dl class="cf">
                            <dt class="fl lang"  data-l="1011"></dt>
                            <dd class="oh">{{goods_material}}</dd>
                        </dl>
                        </div>
                    <div class="t3">
                        <dl class="cf">
                            <dt class="fl lang"  data-l="1012"></dt>
                            <dd class="oh">{{goods_taste}}</dd>
                        </dl>
                    </div>
                    </div>
                   
                </script>
    <script>
        
           	//备注
    	$(".beizhu-bon").on("click",function(){
    		//备注模板
    		var bzs=JSON.parse(localStorage.getItem("beizhu"))
			$("#beizhu").show().html(template("beizhu-js", {"beizhu":bzs}))
			setlange_obj()//设置前端语言
			
			//设置已有备注
			var beizhup=$("#beizhu_p").text(),beit=""
			if(beizhup!=""){
			$.each(beizhup.split(","), function(i,v) {
				var sp=true;
				$("#all-beizhu .a").each(function(e,s){
					if(v==$(this).text()){
						$(this).addClass("on");
						sp=false;
						return true;
					}
				})
				if(sp){
					beit+=(v+",")
				}
			});
			if(beit!=""){
				beit=beit.substring(0,beit.length-1)
				$("#beizhuinp").val(beit)
				$("#beizhuinp").parents(".input").addClass("open");
			}
		}
			
			
			$("#all-beizhu a.st-a").on("click",function(){
				var $th=$(this);
				$th.toggleClass("on")
			})
			$("#all-beizhu .gp a").on("click",function(){
				var $th=$(this);
				$th.toggleClass("on").siblings().removeClass("on")
			})
			//手动收入备注
			$("#all-beizhu .input .bon").on("click",function(){
				var $th=$(this).parents(".input")
				$th.toggleClass("open");
				if($th.hasClass("open"))
				{
					$th.find("input").val("").focus()
				}else{
					$th.blur()
				}
			})
			
			//确定
			$("#beizhu .bon-red").on("click",function(){
				var beizhu=""
				$("#all-beizhu .a.on").each(function(i,v){
					beizhu+=$(this).text()+","
				})
				var bz=$("#beizhuinp").val()
				if(bz!="") beizhu+=bz+","
				beizhu=beizhu.substring(0,beizhu.length-1);
				$("#beizhu_p").text(beizhu)
				$("#beizhu").hide().html("")
			})
			
			//取消
			$("#beizhu .bg ,#beizhu .close1").on("click",function(){
				$("#beizhu").hide().html("")
			})
		})
    	//打开备注

        //搜索
		var searchtrue=false;
        $("#search-top").keypress(function(e){
		  if(e.keyCode === 13) {
		  	$("#search-top").blur();
		  }
		})
 		$("#search-top").blur(function(){
 		 
		   var vals=$("#search-top").val()//搜索val
		   if(vals=="") return false;
		   $("#menu-right").scrollTop(0)
		   $("#menu-left li.on").removeClass("on");
		   $("#menu-right .box,#menu-right .box .item").hide();
		   var nnn=true;
		   console.log(select_obj)
 			$.each(select_obj, function(i,v) {
		   	  if(v.id!=1 && v.id!=2){
		   	  	$.each(v.goods_list, function(ii,vv) {		   	  		
		   	  		var nam=vv.goods_name.toLowerCase(),
		   	  			sn=vv.sn.toLowerCase();
		   	  			console.log(nam,vals.toLowerCase())
			   		if(nam.indexOf(vals.toLowerCase()) != -1||sn.indexOf(vals.toLowerCase())!=-1){
			   			nnn=false;
			   			$("#main-right-box-"+vv.goods_cate_id).show().find(".item-"+ vv.id).show();
			   		}
			   	});
		   	  }			   
		   });
		   if(nnn) {
		   	$("#nulldata").show()
		   }else{
		   	$("#nulldata").hide()
		   }
		   searchtrue=true;
 		})
		//end
        
        
        
        //获取当前菜谱
        var cookbookid=localStorage.getItem("cookbook"),
        	setmenumore=localStorage.getItem("setmenumore"),//是否多菜谱
        	getcookmenu=JSON.parse(localStorage.getItem("cookbook_list"))
        	//排序
			function sortId(a,b){  
				if(b.time_is==a.time_is && b.is_table==a.is_table && b.is_select!=a.is_select){
					return b.is_select-a.is_select
				}else if(b.time_is==a.time_is && b.is_table!=a.is_table && b.is_select==a.is_select){
					return b.is_table-a.is_table
				}else if(b.time_is!=a.time_is && b.is_table==a.is_table && b.is_select==a.is_select){
					return b.time_is-=a.time_is
				} 
		    }
			getcookmenu.sort(sortId);
        //设置头部菜谱切换
        if(setmenumore=="1"){
        	console.log(JSON.parse(localStorage.getItem("cookbook_list")))
        	$("#caipu_top").html(template("menu-top", {list:getcookmenu,cur:cookbookid}));
        	$("#menu-left").css("top","0.8rem")
        }else{
        	$(".caipu_top_box").hide();//隐藏菜谱选择
        	$("#menu-left").css("top","0")
        }
        //点击切换
        $("#caipu_top").find("a").on("click",function(){
        	var $th=$(this);
        	
        	if($th.hasClass("on"))  return false;
        	$th.addClass("on").siblings().removeClass("on");
        	
			localStorage.setItem("cookbook",$th.data("cookbook"))
			cookbookid=localStorage.getItem("cookbook")
			getcookid=cookbookid;
         	defaultfun();
         	
        })
        
        
        //设置gps距离
        var setkm="",gps1="",
        	setjunli=true;//判断距离是否可以点餐

//      if(localStorage.getItem("gpsset")==1){
//      	setjunli=false;
//      }
//		if(getCookie("gps")=="null"){
//			setkm="";
//		}else{
//			mygps=getCookie("gps").split(",")			 		
//		 	var sgps=localStorage.getItem("shopgps").split(","),
//		 		km=getGreatCircleDistance(mygps[0], mygps[1], sgps[0],sgps[1]);	
//		 		setkm=km;
//		 		gps1=getCookie("gps");
//		 	if(setkm<200){
//		 		setjunli=true;
//		 	}
//		}

		//下单
		$("#xiachu").on("click", function () {	
			console.log(!setjunli)
			if(!setjunli){
			 $.modal({
                title: lange["1124"],
                text: "<span class='c666'>"+lange["1200"]+"</span>",
                buttons: [
                  { text: "OK", onClick: function () {
                  	
                  }}
                 ]
             });
             return false;
			}
			
		   var ts1="",//提示内容
		   	   ts2="",//按钮1
		   	   ts3="",//按钮2
		   	   ts_prop=""
		   //选择人数
		   if(!(localStorage.getItem("pax")>0)){
		   		ts_prop+="<div class='xuanzeprop' id='xuanzeprop'><div class='mag-t-20 center tit1' ><span data-l='1149'></span></div>"
		   		ts_prop+="<div class='cf list'>";
		   		for(var s=1;s<11;s++){
		   			ts_prop+="<span><i>"+s+"</i></span>";
		   		}
		   		ts_prop+="<span class='oth'><input type='number' data-p='1150' /></span>";	
		   		ts_prop+="</div></div>";		   		
		   }
		   //
		   
		   if(cart_obj.th_number==0){
 			  ts1=lange["1121"]+ts_prop,
		   	  ts2=lange["1017"],
		   	  ts3=lange["1016"];
		   }else{
		   	  ts1=lange["1119"]+ts_prop,
		   	  ts2=lange["1120"],
		   	  ts3=lange["1121"];
		   }
		   //是否有其他用户
//		   if(getCookie("other")!="null"){
//			   
//		   }else{
//		   	  ts1=lange["1121"]+ts_prop,
//		   	  ts2=lange["1017"],
//		   	  ts3=lange["1016"];
//		   }
		  
		   //下单提示
		   $.modal({
                title: lange["1124"],
                text: "<span class='c666'>"+ts1+"</span>",
                buttons: [
                  { text: "<span class='aaa'>"+ ts2 +"</span>", onClick: function () {}},
                  {
                      text: ts3, onClick: function () {
                    
                       var beizhu=$("#beizhu_p").text();						
					   var pack=$("#other_set0_2").prop("checked")?1:0;	
					  
					  //设置定位
					  //alert(getCookie("gps"))	
					  
					  var newtjiao = [];
					    $.each(cart_obj.my_list[getCookie("yingsoft_home_member_id")], function (i, v) {
					    	//如果不是多菜谱只提交当前菜谱数据
					    	 if(localStorage.getItem("setmenumore")!="1"){
					    	 	if(v.cookbook==cart_obj.curcookbook){
					    	 		newtjiao.push(v);
					    	 	}
					    	 }else{
					    	 	newtjiao.push(v);
					    	 }
					    })
					    if(newtjiao.length==0) return false;
						
						global_ajax(jsonpath + "put_shop_order_confirm", { "remarks": beizhu,"is_pack":pack ,"cookbook_id": cookbookid,"pax":pxas,"gps":gps1,"distance":setkm,"shop_table_id": localStorage.getItem("shop_table_id"),"goods_list":newtjiao}, function (e) {
						 
						 //如果多菜谱移除全部不是多菜谱移除当前菜单
//						 if(localStorage.getItem("setmenumore")!="1"){
//
//						 	var arr=cart_obj.my_list[getCookie("yingsoft_home_member_id")],
//						 		ii=arr.length
//						 	 while(ii--){
//						 	 	console.log(arr[ii].cookbook,cart_obj.curcookbook)
//								 if(arr[ii].cookbook==cart_obj.curcookbook){
//								  arr.splice(ii,1);
//								 }
//							 }
//						 	 localStorage.setItem("cart_obj",JSON.stringify(cart_obj))
//				    	 }else{
//				    	 	localStorage.removeItem("cart_obj")
//				    	 }
						 localStorage.removeItem("cart_obj")
						 //
						 if(!(localStorage.getItem("pax")>0))  localStorage.setItem("pax",pxas)
			             Q.go("finish-html?point="+e.result.point)
			        })                       
                      }
                  }
                ]
            });
		   setlange_obj()//设置前端语言
		   //
		   var pxas=localStorage.getItem("pax")//设置人数
		   var queding=$(".weui-dialog__ft .weui-dialog__btn:last-child")
		   if(localStorage.getItem("pax")==0) queding.addClass("null")//禁用确定按钮
		   queding.on("click",function(){
		   		if($(this).hasClass("null")){
		   			$("#xuanzeprop .tit1").addClass("tips")
		   		}
		   })
		   
		   //选择人数设置
		   $("#xuanzeprop span i").on("click",function(){
		   	 var p=$(this).parent();
		   	 	 p.addClass("on").siblings().removeClass("on");
		   	 	 pxas=$(this).text();
		   	 	$("#xuanzeprop input").val("");
		   	 	 queding.removeClass("null")
		   })
		   $("#xuanzeprop input").on("focus",function(){
		   		 var p=$(this).parent();
		   	 	 p.addClass("on").siblings().removeClass("on");		   	 	 
		   	 	 queding.removeClass("null");
		   })
		   $("#xuanzeprop input").on("blur",function(){
		   		 var p=$(this).val();
		   	 	 if(p>0){
		   	 	 	pxas=$(this).val();
		   	 	 }else{
		   	 	 	$("#xuanzeprop input").val("");
		   	 	 	$(this).parent().removeClass("on");
		   	 	 	 queding.addClass("null")
		   	 	 }
		   })
		   //设置最大人数99；
		   $("#xuanzeprop input").on("input propertychange",function(){
		   		 var p=$(this).val();
		   		 if(p>=99){
		   		 	$(this).val(99);
		   		 }
		    })
		   //
		   
		})
        
        //$(".test0001").remove();
        //$("body").append('<div class="test0001" style="position:fixed; z-index:100000000000; left:0; bottom:0; background:#000; color:#fff; font-size:12px; padding:5px;">程序调试：' + getCookie("yingsoft_home_member_id") + '</div>')
        //设置语言
		var guqing_obj={}
        var defaultfun = function () {
            //
            if(localStorage.getItem("key1")!=null){
            	var ss=JSON.parse(localStorage.getItem("key1"));
            	global_ajax(jsonpath + "get_shop_goods_status_list", '', function (e) {
					guqing_obj=e.result;
					setlist(ss);
	                setselect_item();
				})
            	
            }else
            {
            	
           var setlangua=getCookie("language")

           $.ajax({
	        type: "get",
	        dataType: "json",
	        url: oss+"/shop_goods/"+ getCookie("shopid") +"_"+setlangua+".json",
	        cache: false,
	        success: function (e) {
	        	 //设置返回值
		               localStorage.setItem("key1", JSON.stringify(e))
		               
		               var key2={},key3={},key4={},key5={};
		               $.each(e.result.list,function(i,v){
		               		if(v.id==1||v.id==2){}else{
		               			$.each(v.goods_list,function(ii,vv){               				
		               				key2[vv.id]=vv;		               				
		               			})               			
		               		}
		               });
		               $.each(e.result.spec_list,function(iii,vvv){
           					key3[vvv.spec_id]=vvv;
           				})
           				$.each(e.result.taste_list,function(iii,vvv){
           					key4[vvv.taste_id]=vvv;
           				})
           				$.each(e.result.garnish_list,function(iii,vvv){
           					key5[vvv.garnish_id]=vvv;
           				})
		               
					  //设置菜品
					   localStorage.setItem("key2", JSON.stringify(key2))
					   localStorage.setItem("key3", JSON.stringify(key3))
					   localStorage.setItem("key4", JSON.stringify(key4))
					   localStorage.setItem("key5", JSON.stringify(key5))
					   caidan_json=key2;
					   guige1_json=key3;
					   kouwei1_json=key4;
					   peicai_json=key5;
	            		
	            	var ss=e;
	            	global_ajax(jsonpath + "get_shop_goods_status_list", '', function (e) {						
						guqing_obj=e.result;
						setlist(ss);
		                setselect_item();
					})
	            	
	            		
	        },
	        error: function () {
	      	        	
		            $.modal({
			          title: "tips",
			          text: "Loading error",
			          buttons: [
			            { text: "Refresh", onClick: function(){
			            	window.history.go(-1);
			            	location.reload(true)  
			            } }
			          ]
			       });
	        }
	       })

           
	        }            
            //
        };
        
        var getcookid=cookbookid;
        //设置当前菜单是否可用
    	var menuobj=JSON.parse(localStorage.getItem("cookbook_list")),
    		curmenu=getjsons(menuobj,getcookid,"id");
//  		console.log(curmenu)
//  		if(curmenu.time_is==0 || curmenu.is_table==0 || curmenu.is_select==0 ){
//  			$("#select-buy").hide()
//  			$("#select-buy1").show();
//  			var il=0;
//  			if(curmenu.is_select==0){
//  				il=1201;
//  			}else{
//  				if(curmenu.time_is==0){
//  					il=1148;
//  				}else if(curmenu.is_table==0){
//  					il=1194;
//  				}
//  			}
//  			console.log(curmenu)
//  			console.log(il)
//  			var ht="<span>"+ lange[1202] +"</span>&nbsp;&nbsp;&nbsp;&nbsp;<span>"+ lange[il] +"</span>";
//  			$("#select-buy1").find("p").html(ht)
//  			
//  		}else{
//  			$("#select-buy").show()
//  			$("#select-buy1").hide()
//  		}
    	//
        var setlist=function(e){
        	
        	//设置菜谱是否可用
        	curmenu=getjsons(menuobj,getcookid,"id")    ;
    		console.log(curmenu)
    		if(curmenu.time_is==0 || curmenu.is_table==0 || curmenu.is_select==0 ){
    			$("#select-buy").hide()
    			$("#select-buy1").show();
    			var il=0;
    			if(curmenu.is_select==0){
    				il=1201;
    			}else{
    				if(curmenu.time_is==0){
    					il=1148;
    				}else if(curmenu.is_table==0){
    					il=1194;
    				}
    			}
    			console.log(curmenu)
    			console.log(il)
    			var ht="<span>"+ lange[1202] +"</span>&nbsp;&nbsp;&nbsp;&nbsp;<span>"+ lange[il] +"</span>";
    			$("#select-buy1").find("p").html(ht)
    			
    		}else{
    			$("#select-buy").show()
    			$("#select-buy1").hide()
    		}
        	
        	
        	select_obj = e.result.list;
               
               var stlist1=e.result
                //设置估清菜品              
                 //console.log(stlist1.list)  
                 
                 //判断分类时间状态
                 var leftarrtime={}
                  $.each(stlist1.list, function(ii,vv) {
	                  	//判断分类时间是否可用
	                	var lefttime=0;
						if(vv.begin_time>0 && vv.end_time>0 && !lefttime){					
		            		lefttime=rettime1(vv.begin_time,vv.end_time,vartime);
		            		//console.log(1,lefttime);
		            		if(vv.begin_time1>0 && vv.end_time1>0 && !lefttime){            			
		            			lefttime=rettime1(vv.begin_time1,vv.end_time1,vartime);  
		            			//console.log(2,lefttime);
		            			if(vv.begin_time2>0 && vv.end_time2>0 && !lefttime){            				
		            				lefttime=rettime1(vv.begin_time2,vv.end_time2,vartime);
		            				//console.log(3,lefttime);
		            			}
		            		}
		            	}else{
		            		lefttime=1;
		            	}
		            	//console.log(time_is)
		            	if(lefttime==1){
		            		//console.log(vv.week)
		                	if(vv.week!="" && vv.week!=undefined){
		                		var nwerk=new Date();
		    					nwerk.setTime(vartime*1000);
		    					var mwk=vv.week,
		    						gw=getweek(nwerk);
		    					if(mwk.indexOf(getweek(nwerk))==-1){
		    						lefttime=0;
		    					}
		                	}else{
		                		lefttime=1;
		                	}
		            	}
		            	vv.lefttime=lefttime;
		            	
		            	leftarrtime[vv.id]=lefttime;
                  })
                 //end 判断分类时间是否可用
                 
                 
            	 $.each(stlist1.list, function(ii,vv) {
                	var lefthide=true;//判断是否左侧栏目隐藏——菜谱
                	var lefthidetime=true;//判断是否左侧栏目隐藏——时间
                	var leffhide_2=true;//判断是否左侧栏目隐藏——估清
                	
                	vv.hide=1;
                	var huizong=false;
	                $.each(vv.goods_list, function(i,v) {
	                	//设置菜单
	                	var righthide=true;//判断是否左侧栏目隐藏

	                	//判断分类时间是否可售	                	
	                	if(leftarrtime[v.goods_cate_id]==1){
	                		lefthidetime=false;
	                		v.lefttime=1;	                		
	                	}else{
	                		v.lefttime=0;
	                		
	                	}
	                	//end判断分类
	                	
	                	//判断菜谱
	                	$.each(v.cookbook_id,function(ci,cv){
	                		if(cv==getcookid){	                		 
	                		  lefthide=false;
	                		  righthide=false
	                		  return false;	
	                		}
	                	})
	                	if(v.cookbook_id.length==0){
	                		 lefthide=false;
	                		 righthide=false
	                	}
	                		//如果菜谱没有菜品隐藏
	                	if(righthide){
		            		v.hide=1;
		            	}else{
		            		v.hide=0;
		            	}
		            	//end菜谱
		            	
		            	//console.log(v.goods_name,guqing_obj.list[v.id])
		            	
	                	//设置是否估清菜品
	                	
			   			if(guqing_obj.list[v.id]!=undefined)
	            		{
	            			leffhide_2=false;
	            			v.status=1;
	            		}else
	            		{	            			
	            			v.status=2;
	            		}
	            		
	                	
	            		
	            		//end估清
	            		
	            		//判断三种状态是否都通过了现在左侧，status=估清、hide=菜谱、lefttime=分类时间
	            		if(v.status==1 && v.hide==0 && v.lefttime==1){
	            		  	huizong=true;
	            		}
	            		//end
	            	});
	            	
	            	
	            	//end
	            	//三种状态是否都通过,显示左侧栏目
	            	if(huizong) vv.hide=0;
	            	
            	});
            	console.log(stlist1)
            	//返回时分秒时间戳字符串字符串
            	function time1(s){
            		var nn=new Date();
					nn.setTime(s*1000) ;               	
					return nn.format("hhmmss");
            	}
            	//判断是否设置了时间
            	function rettime1(s,d,c){
            		var time_is=1;
                	var beg=time1(s),//开始
                		end=time1(d),//结束
                		cur=time1(c);//当前	
                		//console.log(beg , cur, end)
                	if(end>beg){
                		//如果结束时间大于开始时间
                		if(beg < cur && end > cur){
                			time_is=1;
                		}else{
                			time_is=0
                		}
                		
                	}else{
                		//隔天
                		if(beg > cur && end < cur){
                			time_is=1;
                		}else{
                			time_is=0;
                		}
                	} 
                	return time_is;            		
            	}
            	//end
            	
            	var nnn=1;
            	if(curmenu.time_is==0 || curmenu.is_table==0 || curmenu.is_select==0 ){
            		nnn=0
            	}
            	
            	stlist1["menu"]=nnn;
            	stlist1["oss"]=oss;
                console.log(stlist1.list)
                $("#menu-right").html(template("menu-right-js", stlist1));
                $("#menu-left").html(template("menu-left-js", stlist1));
				

                setlange_obj()//设置前端语言

                //设置定位
                $(".menu-left li").click(function () {
                    var $th = $(this),
                        id = $th.data("id");
//                      tp = $(".menu-right .box[data-id=" + id + "]").position().top,
//                      stp = $(".menu-right").scrollTop();
//                  $(".menu-right").scrollTop(stp + tp);
					
					
					$(".menu-right").scrollTop(0);
                    $("#main-right-box-" + id).show().siblings().hide();
                    $(this).addClass("on").siblings().removeClass("on")
                    //搜索后点击
                    if(searchtrue){
                    	searchtrue=false;
                    	$("#menu-right .item").show();
                    	$("#search-top").val("")
                    }
                    
                })
				$("#menu-left li").eq(0).addClass("on").click();
				
                //设置盒子高度
                $(".menu-btm").css("max-height", $(window).height() - $("#select-buy").height() - $(".titles").height())
				
				 //滚动定位
                var mr = $("#menu-right"),
                	ml = $("#menu-left"),
                	mllist = $("#menu-left li"),
                	mlheight=ml.height(),
                	mlscroll=ml.find("ul").height()+$(".bank100").height(),
                	onindex=0;//默认索引值
                
                
                // 简单的节流函数
			
				// 实际想绑定在 scroll 事件上的 handler
				function realFunc(){					
				    var st = mr.scrollTop(),
                    	lt1=ml.scrollTop(),
                    	th1=$(".title").height(),
                    	wh=$(window).height()-$("#select-buy").height()-th1,
                    	ont=$("#menu-left .on").offset().top;
      
                    mr.find(".box").each(function (e) {
                        var $th = $(this),
                            $h = $(this).height(),
                            $t = $(this).position().top;
                        if ($t <= 0 && $t + $h > 0) {
                            $("#menuleft-" + $th.data("id")).addClass("on").siblings().removeClass("on");                            
                        }
                    })
                    var onsind=$("#menu-left li.on").index()
                   
                    if(mlheight<mlscroll){
                    	if(onindex!=onsind)
                    	{
                    		var sx=mlscroll-mlheight,
                    			l=mllist.length;
                    			ml.animate({scrollTop:sx*(onsind/l)},200);                    		
                    	}
                    }
                    onindex=onsind;
				}
                

				
        }
        
        //全部打包
        $("#other_set0_2").click(function(){
        	var  $list=$("#my-list"),
        		 $th=$(this),
        		 $json=cart_obj.my_list[getCookie("yingsoft_home_member_id")],
        		 $pak=0;
        	//全部
    		$list.find(".item-l .td5").each(function(){
    			var $td5=$(this);
    			//console.log($th.prop("checked"))
    			if($th.prop("checked")){ 
    				//console.log($td5)
    				$td5.addClass("on")
    			}else{
    				$td5.removeClass("on")
    			}	
    		});
    		
    		$.each(cart_obj.my_list[getCookie("yingsoft_home_member_id")], function(i,v) {
    			v.is_pack=1
    		});
    		
    		//全部打包接口
    		$th.prop("checked")?$pak=1:$pak=0; 
    		//设置已选菜品缓存
	        localStorage.setItem("cart_obj",JSON.stringify(cart_obj))
//			global_ajax(jsonpath + "edit_cart_pack_all", {"is_pack": $pak }, function (e) {
//	       		console.log(1);
//	    	})
        	
        })
	
		 //清空全部
	        $(".carbuy .car-tit .fr").click(function () {
	            //delete_cart
	            $.modal({
	                title: lange['1015'],
	                text: lange['1014'],
	                buttons: [
	                  { text: lange['1017'], className: "default" },
	                  {
	                      text: lange['1016'], onClick: function () {
	                      	
	        				//如果多菜谱移除全部不是多菜谱移除当前菜单
							if(localStorage.getItem("setmenumore")!="1"){
							 	var arr=cart_obj.my_list[getCookie("yingsoft_home_member_id")],
							 		ii=arr.length
							 	 while(ii--){
							 	 	console.log(arr[ii].cookbook,cart_obj.curcookbook)
									 if(arr[ii].cookbook==cart_obj.curcookbook){
									  arr.splice(ii,1);
									 }
								 }
							 	 localStorage.setItem("cart_obj",JSON.stringify(cart_obj))
					    	}else{
					    	 	localStorage.removeItem("cart_obj")
					    	}
	        				
	        				
	                      	setselect_item();
					                //console.log(123123)
					        $(".select-menu").removeClass("open-gwc");
					        
					        
	                      }
	                  }
	                ]
	            });
	        });
        
        var setselect_item=function(){
	        	//初始化已选数据
		        var getitms=localStorage.getItem("cart_obj")
		        //设置桌号
		        $(".title1").text(localStorage.getItem("shop_table_name"));
		        if(getitms!=null){
		        	cart_obj=JSON.parse(getitms)
		        	marry_fun();
		        }else{	
		        	cart_obj = {
		                	"total_money":0,
		                	"my_number": 0,
		                	"th_number": 0,
		                	"open_other":false,
		                    "member_id": getCookie("yingsoft_home_member_id"),
		                    "my_list": {},
		                    "cart_id_list": {},
		                    "order_info":{}
		                }
		                
		        }
		        marry_fun();
	        }
        	
        	
	        
	      	//更新数据
			function setaddss(data1){
				var ss=data1;   
				
	            var name1 = caidan_json[ss.goods_id].goods_name,
	            	guige = ss.spec_id!=0 ? guige1_json[ss.spec_id].goods_spec_name :null,
		            kouwei = ss.taste_id!=0 ? kouwei1_json[ss.taste_id].goods_taste_name:null;
	            	ss["goods_name"]=name1;
	            	ss["goods_spec_name"]=guige;
	            	ss["goods_taste_name"]=kouwei;
	            	if(!!ss.garnish_ids){
		            	$.each(ss.garnish_ids, function (ii, vv) {
		            		var name2 = peicai_json[vv.garnish_id].goods_garnish_name;
		            		vv["goods_garnish_name"]=name2;
		            	});
	            	}
            	return ss;
		}
			
        //匹配以选择数据
        var marry_fun = function (data) {
			//处理新插入的数据
			var newd1=true//是否新增数据
			
			if (data!=undefined)
            {
            	var data1 = data,
            	slist=cart_obj.my_list[data1.member_id];            	
 				if(slist!=undefined)
 				{
 					
 					var sss=getjsons(slist,data1.cart_id,'cart_id'),
 						sssid=getindex(slist,data1.cart_id,'cart_id')
            		if(sss.cart_id!=undefined)
 					{
	 					newd1=false;
	 					
						if(data1.count==0){
							//删除数据
						
							var ojs1=$("#menu-right .item-"+ data1.goods_id);
							if(ojs1.find(".addright").attr("data-num")==1){
								ojs1.find(".g3").text(0);
								ojs1.find(".addright").attr("data-num", 0);
								ojs1.removeClass("add")
							}
							
							//$("#menu-right .item[data-id="+ data1.goods_id +"] .g3").text(0);
			    			//$("#menu-right .item .addright").attr("data-num", 0);
							cart_obj.my_list[getCookie("yingsoft_home_member_id")].splice(sssid,1)
			
						}else{
							slist[sssid]=setaddss(data1)//更新数量
							//console.log(slist[sssid])
							//更新界面							
							//myobj.find(".addright").attr("data-num", data1.count);
							//myobj.find(".addright").find(".g3").text(data1.count);
						}
					}
					
 				}
 				//判断是否新增数据
 				if(newd1){                    	
                    //添加名称 规格名称   
		                if(!!!cart_obj.my_list[setaddss(data1).member_id]) cart_obj.my_list[setaddss(data1).member_id]=[];		                
                    	cart_obj.my_list[setaddss(data1).member_id].push(setaddss(data1))
 				}
            	//更新界面数字状态；
            }
			//i
			
	        //购物车列表
	    	$(".menu-left li i,#select-buy .left .gw i,#select-buy .left .gw em").text("");
	    	$("a i","#caipu_top").hide().text("");
	    	var objs=$("#menu-right .item"),
				nums=objs.find(".addright").attr("data-num",0);
		    	cart_obj.th_number=0;
		    	cart_obj.my_number=0;
		    	cart_obj.total_money=0;
		        $.each(cart_obj.my_list, function (ii, vv) {
	                	 //判断是否有其他用户
	                	if(cart_obj.member_id != ii){

	                	}else{
	                		var mright=$("#menu-right")
	                		$.each(vv, function (i, v) {
	                			
	                			//如果不是多菜谱而且菜谱ID也不相同 跳出累加
	                			if(localStorage.getItem("setmenumore")!="1" && v.cookbook!=getcookid){
	                				return true;
	                			}
	                			
	                			if(v.status==1){
	                				//设置数量
			                		cart_obj.my_number += Number(v.count);
			                		//左侧分类列表
				                    var cate_id = $("i","#menuleft-" + v.goods_cate_id).text();
				                    cate_id = cate_id != '' ? cate_id : 0
				                    var ss = 0;
				                    if(v.cookbook==getcookid){
				                    	ss=accAdd(cate_id, v.count)
				                    }else{
				                    	ss=accAdd(cate_id, 0)
				                    }
				                    if (ss > 0) {
				                        $("i","#menuleft-" + v.goods_cate_id).text(ss);
				                    }
				                    
				                    
				                    
				                    //菜单数字
				                    var caipu_id = $("i","#caipu_" + v.cookbook).text();
				                    caipu_id = caipu_id != '' ? caipu_id : 0;
				                    var ss1 = accAdd(caipu_id, v.count);
				                    console.log(ss1)
				                    if (ss1 > 0) {
				                        $("i","#caipu_" + v.cookbook).text(ss1).show();
				                    }else{
				                    	$("i","#caipu_" + v.cookbook).hide()
				                    }
				                    
				                    //设置总价
				                    cart_obj.total_money = accAdd(cart_obj.total_money, v.total_price)
				                    
				                    //右侧菜列表
				                      if(v.member_id==cart_obj.member_id && v.cookbook==getcookid)
					                  {
				                    	  var objs=mright.find(".item-" + v.goods_id),
					                      nums=objs.find(".addright").attr("data-num");
						                  if(v.count > 0) {
						                  	objs.addClass("add")
						                  }
						                  objs.find(".g3").text(accAdd(v.count,nums));
						                  objs.find(".addright").attr("data-num", accAdd(v.count,nums));
						                  objs.find(".addright").attr("data-cart_id", v.cart_id);
					                  }	
			                   }
		                   
	                		})
	                	}
	                	//总价
	                	
		        })
		        
	        //格式化金额
	        cart_obj.total_money=toFixed2(cart_obj.total_money, 2)
	        $("#total_price span").text(cart_obj.total_money);
	        
	        //清空数据调用
	        if (cart_obj.my_number == 0 && cart_obj.th_number == 0) {
	        	$("#menu-right .item").removeClass("add")
	        	$(".select-menu").removeClass("open-gwc");
	        	$("#select-buy").removeClass("open");
	        	$("a i","#caipu_top").hide().text("0")
	        	$("#menu-right .item .g3").text(0);
			    $("#menu-right .item .addright").attr("data-num", 0);
	        } 
            if (cart_obj.my_number > 0) {
                $("#select-buy").addClass("open");
                $("#select-buy .left .gw i").text(cart_obj.my_number);
            }
            if (cart_obj.th_number > 0) {
            	$(".car-box").removeClass("open-otehr"); 
                $("#select-buy").addClass("open");
                $("#select-buy .left .gw em").text(cart_obj.th_number);
            }else{
            	$(".car-box").addClass("open-otehr"); 
            }
	        //
	        //console.log(cart_obj)
	        
	        //是否多菜谱
	        cart_obj["setmenumore"]=localStorage.getItem("setmenumore");
	        //当前菜谱id
	        cart_obj["curcookbook"]=localStorage.getItem("cookbook");
	        
	        //只有添加新数据才更新模板
	        $("#my-list").html(template("select-buy-js1", cart_obj));
            $("#other-list").html(template("select-buy-js2", cart_obj));
            
            //单独打包
			 $(".item-l .td5","#my-list").click(function () {

			 	var $th=$(this),
			 		$p=$th.parents(".item-l"),
			 		$ind=$p.index(),
			 		$id=$p.attr("data-cart_id"),
			 		$pak=0;
			 		$th.toggleClass("on");
			 		if($th.hasClass("on")){
			 			$pak=1;
			 		}else{
			 			$pak=0;
			 		}
			 	
			 	cart_obj.my_list[getCookie("yingsoft_home_member_id")][$ind].is_pack=$pak;
//				global_ajax(jsonpath + "edit_cart_pack", {"cart_id": $id,"is_pack": $pak }, function (e) {
//		       		
//		    	})
				
				//判断是否全部清除打包状态
				var  $list=$("#my-list"),
					 $chk=$("#other_set0_2"),
					 $leng=cart_obj.my_list[getCookie("yingsoft_home_member_id")].length,
					 $listleng=$list.find(".item-l .td5.on").length;
				
				if($listleng==$leng){
					$chk.prop("checked",true)
				}else{
					$chk.prop("checked",false)
				}
				
				   //设置已选菜品缓存
	        	localStorage.setItem("cart_obj",JSON.stringify(cart_obj))
			 })
            
			$(".car-box .addright .p2,.car-box .addright .p1").on("click", function (e) {
				e.stopPropagation();
				e.preventDefault();
				setClick($(this),true)
			});
			
	        setlange_obj()//设置前端语言
	        
	        
	        //设置已选菜品缓存
	        console.log(cart_obj)
	        localStorage.setItem("cart_obj",JSON.stringify(cart_obj))
        }
		

 		defaultfun()
    </script>

</div>
</div>